<?php
// 组件由 config/autoload/config_center.php 配置文件来驱动，如果没有改文件,自行创建：
declare(strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */
use Hyperf\ConfigCenter\Mode;
use function Hyperf\Support\env;

return [
    'enable' => (bool) env('CONFIG_CENTER_ENABLE', true),
    // 驱动
    'driver' => env('CONFIG_CENTER_DRIVER', 'nacos'),
    'mode' => env('CONFIG_CENTER_MODE', Mode::PROCESS),
    'drivers' => [
        'nacos' => [
            'driver' => Hyperf\ConfigNacos\NacosDriver::class,
            'merge_mode' => Hyperf\ConfigNacos\Constants::CONFIG_MERGE_OVERWRITE,
            'interval' => 3,
            'default_key' => 'nacos_config',
            'listener_config' => [
                // dataId, group, tenant, type, content
                // 配置中心的配置文件
                'nacos_config' => [
                    // 命名空间/ID
                    'tenant' => 'public', // corresponding with service.namespaceId
                    // DataID
                    'data_id' => 'hyperf-service-config',
                    // 组名
                    'group' => 'DEFAULT_GROUP',
                    // 数据类型
                    'type' => 'json',
                ],

            ],
            'client' => [
                // 客户端
                'host' => 'nacos-standalone-mysql',
                'port' => 8848,
                'username' => 'nacos',
                'password' => 'nacos',
                'guzzle' => [
                    'config' => null,
                ],
                'grpc' => [
                    'enable' => true,
                    'heartbeat' => 10,
                ],
            ],
        ],
    ],
];